﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace VirtualOperator
{
    public partial class NodeDetails : Form
    {
        private VirtualNetwork.Matrix matrix;

        public NodeDetails(string overview, string routing)
        {
            InitializeComponent();
            overviewTextBox.Text = overview;
            usersTextBox.Text = routing ;
        }

         public NodeDetails(VirtualNetwork.Matrix node)
         {
             InitializeComponent();
             matrix = node;
             overviewTextBox.Text = "Basic information: " + Environment.NewLine;
             overviewTextBox.Text += "Name: " + node.Name + Environment.NewLine;
             overviewTextBox.Text += "ID: " + node.ID + Environment.NewLine;
             overviewTextBox.Text += "Type: " + node.Type + Environment.NewLine;
             overviewTextBox.Text += "GeoPosition: [" + Math.Round(node.Possition.X, 2) + "," + Math.Round(node.Possition.Y, 2)  + "]"+ Environment.NewLine;
             usersTextBox.Text="";
             foreach (NwTTP nwttp in node.NwTTPs.Values)
             {
                 usersTextBox.Text += nwttp.Name + ", [" + nwttp.ID + "], " + nwttp.Type + Environment.NewLine;
             }
         
         }

        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            matrix.Open = false;
            this.Close();
        }

        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {

        }

        private void NodeDetails_FormClosed(object sender, FormClosedEventArgs e)
        {
            matrix.Open = false;
        }
    }
}
